package com.learn.gc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author chenxin
 * @time 2017-02-17-09:33
 */
public class StaticPermTest {
    public static Map<String, MyObject> map = new HashMap<String, MyObject>();
    public static void main(String[] args) {
        //=====================Begin=========================
        System.out.print("Xmx=");
        System.out.println(Runtime.getRuntime().maxMemory() / 1024.0 / 1024 + "M");


        for (int i = 0; i < Integer.MAX_VALUE; i++){
            map.put(String.valueOf(i), new MyObject());
        }
        System.out.println("end");
    }

    public static class MyObject{
        MyObject() {
            byte[] bytes = new byte[5*1000*1024]; //1M
        }
    }


//    static String  base = "string";
//    public static void main(String[] args) {
//        List<String> list = new ArrayList<String>();
//        for (int i=0;i< Integer.MAX_VALUE;i++){
//            String str = base + base;
//            base = str;
//            list.add(str.intern());
//        }
//    }
}
